<script src="__PUBLICURL__/ui/lhgcalendar/lhgcalendar.min.js"></script> 
<script src="__PUBLICURL__/ui/jquery/iColorPicker.js"></script>
<script>

$(function(){
    $('#time').calendar({ format:'yyyy-MM-dd HH:mm:ss' });
	if($.trim($('#channel_exp').html())==''){
	ajax_fields(); //cookies选择获取扩展模型
	}
});
</script>

<script>
function ajax_fields()
 {
	var cid = $('#cid').val();
	$('#channel_exp').html('');
	$.ajax({
		type: 'POST',
		url: "__APP__/plus/ext_field",
		data: {
			cid: cid
		},
		dataType: "json",
		success: function(data) {
			for (var i in data) {
				var list_html = '<tr  class="';
				if (i % 2 !== 1) {
					list_html += 'table_style_even';
				}
				list_html += '">';
				list_html += '<td width="100"  align="left" valign="middle">' + data[i].name + ':</td>';
				list_html += '<td>';
				if (data[i].type == 1) {
					list_html += '<input name="' + data[i].field + '" type="text" class="regular-text" value="' + data[i].default_val + '" />';
				}
				if (data[i].type == 2) {
					list_html += '<textarea name="' + data[i].field + '" id="' + data[i].field + '" cols="0" class="regular-textarea" style="width:300px !important; height:80px">' + data[i].default_val + '</textarea>';
				}
				if (data[i].type == 3) {
					list_html += '</tr><tr><td colspan="2"><textarea name="' + data[i].field + '" id="' + data[i].field + '" cols="0" class="regular-textarea" style="width:100% !important; height:400px">' + data[i].default_val + '</textarea>';
					
					list_html += "<script>";
					list_html += "$(function() {";
					list_html += "var editor"+ data[i].field +";";
					list_html += "$.getScript('__PUBLICURL__/editor/kindeditor.js', function() {";
					list_html += "KindEditor.basePath = '__PUBLICURL__/editor/';";
					list_html += "editor"+ data[i].field +" = KindEditor.create('textarea[name=\""+ data[i].field +"\"]');";
					list_html += "});";
					list_html += "});";
					list_html += "<\/script>";

				}
				if (data[i].type == 4) {
					list_html += '<select name="' + data[i].field + '"  id="' + data[i].field + '" >';
					default_ary = data[i].default_val;
					ary = default_ary.split("\n");
					for (var x in ary) {
						strary = ary[x].split(",");
						list_html += '<option value="' + strary[0] + '">' + strary[1] + '</option>';
					}
					list_html += '</select>';
				}
				if (data[i].type == 5) {
					list_html += '<input name="' + data[i].field + '" id="' + data[i].field + '" type="text" class="regular-text" value="' + data[i].default_val + '" /><br />';
					list_html += '<iframe scrolling="no"; frameborder="0" src="__APP__/upload/file.html?inputName=' + data[i].field + '" style="width:300px; height:35px;"></iframe>';
				}
				if (data[i].type == 6) {
					list_html += '<input name="' + data[i].field + '" type="text" class="regular-text" value="' + data[i].default_val + '" />';
				}
				if (data[i].type == 7) {
					list_html += '<input name="' + data[i].field + '" type="text" class="regular-text" value="' + data[i].default_val + '" />';
				}
				if (data[i].type == 8) {
					list_html += '<input name="' + data[i].field + '" type="text" id="' + data[i].field + '" class="regular-text" value="' + data[i].default_val + '" />';
					
					list_html += "<script>";
					list_html += "$(function(){";
					list_html += "$('#"+ data[i].field +"').calendar({ format:'yyyy-MM-dd HH:mm:ss' });";
					list_html += "});";
					list_html += "<\/script>";
				}
				
				list_html += '<input type="hidden" name="my_id" id="my_id" value="' + data[i].pid + '">';
				list_html += '</td>';
				list_html += '</tr>';
				$('#channel_exp').append(list_html);
			}
		}
	});
}
</script>

<script>
<!--提取描述--> 
function limitL(){
	var content=KE.text();
	content=content.substring(0,500);
	content=content.replace(/\s+/g,"")
	content=content.replace(/[\r\n]/g," ");
	content = content.replace(/<\/?[^>]*>/g,''); //去除HTML tag
	if(content.length > 250){
	    content = content.substring(0,250);
	}
	$("#description").attr("value",content);
}

<!--提权关键词--> 
function getkey(){
                $.ajax({

                    type: "POST",
                    url: "__APP__/plus/getkeyword",
                    //得到id	
					data: "title="+$("#title").val(),
					data: "description="+$("#description").val(),

                   dateType:"html",
                    success: function(data) {
          
					 $("#keywords").attr("value",data);
						
                    }
                });
};	
</script>

<script>
$(function() {
if( $('#pic').val()=='' ){}else{
$("#thumbnail_list_xh").append('<li><a href="javascript:void 0" onclick="$(\'#pic\',window.frames[\'frame_content\'].document).val(rel); parent.asyncbox.close(\'thumbnail_l\');" rel="'+ $('#pic').val() + '"><img class="thumbnail_list_img" src="'+ $('#pic').val() + '" width="110" height="80" border="0" /></a></li>')
};
});
</script>